<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class AddFieldToEnterprises extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::table('enterprises', function (Blueprint $table) {
            $table->bigInteger('agent_id')->nullable()->comment('所属代理商')->after('id');
            $table->string('pay_channel', 32)->default('yeepay')->comment('支付通道')->after('agent_id');
            $table->date('licenceNoExpires')->nullable()->comment('商户证件有效期')->after('licenceNo');
            $table->date('legalLicenceNoExpires')->nullable()->comment('法人证件有效期')->after('legalLicenceNo');
            $table->text('business_scope')->nullable()->comment('企业经营范围');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::table('enterprises', function (Blueprint $table) {
            $table->dropColumn(['agent_id', 'pay_channel', 'licenceNoExpires', 'legalLicenceNoExpires', 'business_scope']);
        });
    }
}
